package com.xlink.service.impl;

import com.xlink.dto.Device;
import com.xlink.repository.DeviceRepository;
import com.xlink.service.DeviceService;
import org.moon.base.service.AbstractService;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
//实现类
/**
 * Created by asus1 on 2015/12/6.
 */
@Service
public class DeviceServiceImpl extends AbstractService implements DeviceService {
    @Resource
    private DeviceRepository deviceRepository;
    @Override    //查看设备列表
    public List<Map<String, Object>> list(Map<String, Object> params) {return deviceRepository.list(params);}
    @Override   //查看单个设备
    public Map<String,Object> get(Long deviceId){return deviceRepository.get(deviceId);}
    @Override     //增加设备
    public Long add(Device device) {
        deviceRepository.add(device);
        return device.getId();
    }
    @Override     //修改设备
    public boolean update(Map<String, Object> params) { return deviceRepository.update(params)>0; }
    @Override     //删除设备
    public boolean delete(Long deviceId) { return deviceRepository.delete(deviceId)>0; }

}
